package com.eol.web.controller.common;

import com.eol.common.annotation.HttpApi;
import com.eol.common.base.BaseResponse;
import com.eol.service.sms.SmsService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * CommonController
 *
 * @author liulinhui
 * @email 1249055292@qq.com
 * @date 2020/6/1 21:26
 */
@RestController
@RequestMapping("common")
public class CommonController {

    @Resource
    private SmsService smsService;

    /**
     * 手机验证码
     *
     * @param phone 手机号码
     * @return uuid
     */
    @RequestMapping(value = "smsCode", method = RequestMethod.GET)
    @HttpApi(login = false, name = "手机验证码")
    public BaseResponse smsCode(@RequestParam("phone") String phone) {
        String uuid = smsService.sendVerifyCode(phone);
        return BaseResponse.OK(uuid);
    }
}
